package com.test.resumeanalysis.data.repository

import androidx.lifecycle.LiveData
import com.test.resumeanalysis.App.App
import com.test.resumeanalysis.data.JobPostDao
import com.test.resumeanalysis.data.ResumeDao
import com.test.resumeanalysis.data.model.JobPost
import com.test.resumeanalysis.data.model.resume.ResumeParse

class ResumeRepository() {
    private val jobPostDao: JobPostDao = App.dataBase.jobPostDao()
    private val resumeDao :ResumeDao   =App.dataBase.resumeDao()

    val getAllJobPost: LiveData<List<JobPost>> = jobPostDao.getAllData()

    val getAlResume:LiveData<List<ResumeParse>> = resumeDao.getAllData()

   fun getResume(position:Int):LiveData<ResumeParse> = resumeDao.getDataById(position)



    suspend fun insertJobPost(jobPost: JobPost) {
        jobPostDao.insertData(jobPost)
    }

    suspend fun upJobPost(jobPost: JobPost) {
        jobPostDao.upData(jobPost)
    }

    suspend fun delJobPost(jobPost: JobPost) {
        jobPostDao.delData(jobPost)
    }

    suspend fun insertResume(resumeParse: ResumeParse){
        resumeDao.insertData(resumeParse)
    }
    suspend fun upResume(resumeParse: ResumeParse){
        resumeDao.upData(resumeParse)
    }

    suspend fun delResume(resumeParse: ResumeParse){
        resumeDao.delData(resumeParse)
    }
}